﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ZX.BLL.Extend;
using ZX.SYS.Library;
using ZX.DBModule;
using ZX.EHR.Library;
using ZX.Common;

namespace ZX.BLL
{
    public class BDataLog : BaseBussnies
    {
        public BDataLog()
        {
            this.entity = new SysDataLog();
        }


        public bool SaveLog(Guid? userID,BaseEntity _entity,string dataAction)
        {
            SysDataLog dataLog = this.entity as SysDataLog;
            dataLog.Action = dataAction;
            dataLog.DataLogID = Guid.NewGuid();
            dataLog.UserID = userID==null?Guid.Empty:(Guid)userID;
            dataLog.Data = _entity.ToJSON();
            dataLog.EntityName = _entity.GetTableName();
            dataLog.LogTime = System.DateTime.Now;
            return Insert(dataLog);
        }
        public static BDataLog Instance = new BDataLog();
    }
}
